package xyz.xmh.pattern.behavioral.iteratorpattern;

/**
 * @author Administrator
 * 迭代器模式演示类
 */
public class IteratorPatternDemo {

    public static void main(String[] args) {
        NameRepository nameRepository = new NameRepository();

        for (Iterator iterator = nameRepository.getIterator(); iterator.hasNext(); ) {
            String name = (String) iterator.next();
            System.out.println("Name = " + name);
        }

    }

}
